package com.haiyou.dc.thread;

import com.google.common.util.concurrent.ThreadFactoryBuilder;

import java.util.concurrent.*;

public class TestExecutor {


    public static void main(String[] args) {
        Executors.newFixedThreadPool(10);
        Executors.newSingleThreadExecutor();
        Executors.newScheduledThreadPool(10);
        Executors.newCachedThreadPool();

        ThreadFactory nameThreadFactory = new ThreadFactoryBuilder().setNameFormat("demo-pool-%d").build();
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(3, 10
                , 0L
                , TimeUnit.SECONDS
                , new LinkedBlockingQueue<>()
                , nameThreadFactory, new ThreadPoolExecutor.AbortPolicy());

        threadPoolExecutor.execute(() -> {

        });
    }

}
